<?php
class BaseModelValidation {

	public static ip($ip) {
		$_pattern = array(
			'ip' => '(?:(?:25[0-5]|2[0-4][0-9]|(?:(?:1[0-9])?|[1-9]?)[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|(?:(?:1[0-9])?|[1-9]?)[0-9])',
			'hostname' => '(?:[a-z0-9][-a-z0-9]*\.)*(?:[a-z0-9][-a-z0-9]{0,62})\.(?:(?:[a-z]{2}\.)?[a-z]{2,4}|museum|travel)'
		);
		if (preg_match('/^' . $_pattern['ip'] . '$/',$ip)) {
			return true;
		} 
		else {
			return false;
		}
	}
}
?>